package com.songcha.sakura.ui.activity.test

import android.app.Application
import androidx.lifecycle.MutableLiveData
import com.songcha.library_base.interfaces.IApiResult
import com.songcha.library_base.mvvm.base.BaseRefreshLoadMoreViewModel
import com.songcha.library_base.mvvm.base.BaseRepository
import com.songcha.sakura.bean.ComicListBean


class TestViewModel(app: Application): BaseRefreshLoadMoreViewModel<BaseRepository,ComicListBean.ComicBean>(app) {
    //val comicList = MutableLiveData<ComicListBean>()
    //val comicList: MutableLiveData<ComicListBean> = _comicList

    fun  getComicList(){
        var title="搞笑"
        if(title.isEmpty()) return
        handleApiDataObserver((repository!! as TestRepository).getComicList(title,currentPage),object :
            IApiResult<ComicListBean> {
            override fun onSuccess(bean: ComicListBean) {

                /*handleDataListSuccess(bean.data ,object : IOnHandleDataListCallback {
                    override fun onUpdate() {
                        comicList.value=bean
                    }

                    override fun onAppendList() {
                        val tmp=comicList.value
                        tmp!!.data.addAll(bean.data)
                        comicList.value=tmp!!
                    }

                })*/
            }

        },true)

    }

}